# Contributor: Damian Kurek <starfire24680@gmail.com>
# Maintainer: Damian Kurek <starfire24680@gmail.com>
pkgname=kodi-game-libretro-mame2003
pkgver=0.78.0.54
_realname=Nexus
pkgrel=0
pkgdesc="MAME 2003 GameClient for Kodi"
options="!check" # no test suite
url="https://github.com/kodi-game/game.libretro.mame2003"
arch="x86_64 aarch64 armv7" # kodi is available only on these architectures
license="custom"
makedepends="cmake kodi-dev samurai"
depends="kodi-game-libretro libretro-mame2003"
source="$pkgname-$pkgver-$_realname.tar.gz::https://github.com/kodi-game/game.libretro.mame2003/archive/$pkgver-$_realname.tar.gz"
builddir="$srcdir/game.libretro.mame2003-$pkgver-$_realname"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_MODULE_PATH=/usr/lib/cmake/kodi
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	rm -r "$pkgdir"/usr/lib/kodi/addons/game.libretro.mame2003/game.libretro.mame2003.so
	ln -s /usr/lib/libretro/mame2003_libretro.so \
		"$pkgdir"/usr/lib/kodi/addons/game.libretro.mame2003/game.libretro.mame2003.so
}

sha512sums="
23eb904bd16b8aff0eb32754635e1498a3df962e1a63c1402f4fead327267fd8c3375b27d1c4d0cd29b62e0552862d213ec6583c943196aac13a3bd3995b1874  kodi-game-libretro-mame2003-0.78.0.54-Nexus.tar.gz
"
